package com.kimstore.factory;

import com.kimstore.dao.BatchDao;
import com.kimstore.dao.CustomerDao;
import com.kimstore.dao.ItemDao;
import com.kimstore.dao.OrderDao;
import com.kimstore.dao.ProductDao;
import com.kimstore.dao.PurchaseDetailDao;
import com.kimstore.dao.StaffDao;
import com.kimstore.dao.UserDao;
import com.kimstore.dao.impl.BatchDaoImpl;
import com.kimstore.dao.impl.CustomerDaoImpl;
import com.kimstore.dao.impl.ItemDaoImpl;
import com.kimstore.dao.impl.OrderDaoImpl;
import com.kimstore.dao.impl.ProductDaoImpl;
import com.kimstore.dao.impl.PurchaseDetailDaoImpl;
import com.kimstore.dao.impl.StaffDaoImpl;
import com.kimstore.dao.impl.UserDaoImpl;

public class DaoFactory {

    private static DaoFactory daoFactory;
    private BatchDao batchDao;
    private CustomerDao customerDao;
    private ItemDao itemDao;
    private OrderDao orderDao;
    private ProductDao productDao;
    private UserDao userDao;
    private StaffDao staffDao;
    private PurchaseDetailDao purchaseDetailDao;

    public static DaoFactory getInstance() {
        if (daoFactory == null) {
            daoFactory = new DaoFactory();
        }

        return daoFactory;
    }

    public BatchDao getBatchDao() {
        if (batchDao == null) {
            batchDao = new BatchDaoImpl();
        }

        return batchDao;
    }

    public CustomerDao getCustomerDao() {
        if (customerDao == null) {
            customerDao = new CustomerDaoImpl();
        }

        return customerDao;
    }

    public ItemDao getItemDao() {
        if (itemDao == null) {
            itemDao = new ItemDaoImpl();
        }

        return itemDao;
    }

    public OrderDao getOrderDao() {
        if (orderDao == null) {
            orderDao = new OrderDaoImpl();
        }

        return orderDao;
    }

    public ProductDao getProductDao() {
        if (productDao == null) {
            productDao = new ProductDaoImpl();
        }

        return productDao;
    }

    public UserDao getUserDao() {
        if (userDao == null) {
            userDao = new UserDaoImpl();
        }

        return userDao;
    }

    public StaffDao getStaffDao() {
        if (staffDao == null) {
            staffDao = new StaffDaoImpl();
        }

        return staffDao;
    }
    
    public PurchaseDetailDao getPurchaseDetailDao() {
        if(purchaseDetailDao == null) {
            purchaseDetailDao = new PurchaseDetailDaoImpl();
        }
        
        return purchaseDetailDao;
    }
}
